package scalaLearning.part1.works

object Test1 {
  def main(args: Array[String]): Unit = {
    val x = 2;
    //支持混合类型表达式
    val z = if (x > 1) 1 else "error"
    //打印z的值
    println("z=" + z)
    //如果缺失else，相当于if (x > 2) 1 else ()
    val m = if (x > 2) 1
    println("m=" + m)
    //在scala中每个表达式都有值，scala中有个Unit类，写做(),相当于Java中的void
    val n = if (x > 2) 1 else ()
    println("n=" + n)

    val y = if (1 > 1) 1 else "error"
    println("y=" + y)
  }
}
